#include <cjsondebug.h>

CDebugLog::CDebugLog(const char * file_name)
{
#ifdef CJSON_DEBUG
  ofs.open(file_name, std::ios::app);
#endif
}

CDebugLog::~CDebugLog()
{
#ifdef CJSON_DEBUG
  ofs.close();
#endif
}

CDebugLog & CDebugLog::operator << (const jchar* value)
{
#ifdef CJSON_DEBUG
  if (ofs.is_open())
  {
    ofs << value;
  }
#endif
  return *this;
}

CDebugLog & CDebugLog::operator << (jstring value)
{
#ifdef CJSON_DEBUG
  if (ofs.is_open())
  {
    ofs << value;
  }
#endif
  return *this;
}

CDebugLog & CDebugLog::operator << (int value)
{
#ifdef CJSON_DEBUG
  if (ofs.is_open())
  {
    ofs << value;
  }
#endif
  return *this;
}

CDebugLog & CDebugLog::operator << (unsigned value)
{
#ifdef CJSON_DEBUG
  if (ofs.is_open())
  {
    ofs << value;
  }
#endif
  return *this;
}

CDebugLog & CDebugLog::operator << (unsigned long value)
{
#ifdef CJSON_DEBUG
  if (ofs.is_open())
  {
    ofs << value;
  }
#endif
  return *this;
}

